\hypertarget{class_space_ship}{
\section{SpaceShip Class Reference}
\label{class_space_ship}\index{SpaceShip@{SpaceShip}}
}


{\ttfamily \#include $<$spaceship.h$>$}Inheritance diagram for SpaceShip::\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=2cm]{class_space_ship}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{class_space_ship_ae56e545157e761155089250245ad3455}{SpaceShip} ()
\item 
virtual \hyperlink{class_space_ship_a4442daaa9cdc06a0ff885aedabf8abf0}{$\sim$SpaceShip} ()
\item 
virtual int \hyperlink{class_space_ship_a4231df9fa04a8b82d07f62401000c1b7}{type} () const 
\item 
void \hyperlink{class_space_ship_ac941a05362258554baff929244c9e9f7}{fireBullets} ()
\item 
void \hyperlink{class_space_ship_a4fdfbd1a59a02df5897c2b37a49337c0}{fireMissiles} ()
\end{DoxyCompactItemize}
\subsection*{Private Member Functions}
\begin{DoxyCompactItemize}
\item 
QRectF \hyperlink{class_space_ship_a209b405c57298a7fd22edcf609d9ab36}{boundingRect} () const 
\item 
void \hyperlink{class_space_ship_adfc89b9201d546c24ca0bd7b59b44d24}{paint} (QPainter $\ast$painter, const QStyleOptionGraphicsItem $\ast$option, QWidget $\ast$widget)
\end{DoxyCompactItemize}
\subsection*{Private Attributes}
\begin{DoxyCompactItemize}
\item 
QPixmap \hyperlink{class_space_ship_a5bdb581da7eafb13095e97666ebe83bc}{shipsImage}
\item 
qreal \hyperlink{class_space_ship_a4f960ec3383ec268c7db8c97b97a5c7d}{xPosition}
\item 
qreal \hyperlink{class_space_ship_a01360fa6f81ff5c448d68142293f578b}{yPosition}
\item 
qreal \hyperlink{class_space_ship_a842854c644480d337e52fa125a838cce}{shipWidth}
\item 
qreal \hyperlink{class_space_ship_a344d1e5b92d9286103aef6e1c27f0a76}{shipHeight}
\item 
qreal \hyperlink{class_space_ship_a53bc0fb5aa0a9b0c0d7fc70a76e1feda}{shipHit}
\item 
\hyperlink{class_sleeper_thread}{SleeperThread} $\ast$ \hyperlink{class_space_ship_aa415fbdaccd76864a11592e738cf0348}{t}
\end{DoxyCompactItemize}


\subsection{Detailed Description}
This class creates players spaceship for earth:20000 

Definition at line 19 of file spaceship.h.

\subsection{Constructor \& Destructor Documentation}
\hypertarget{class_space_ship_ae56e545157e761155089250245ad3455}{
\index{SpaceShip@{SpaceShip}!SpaceShip@{SpaceShip}}
\index{SpaceShip@{SpaceShip}!SpaceShip@{SpaceShip}}
\subsubsection[{SpaceShip}]{\setlength{\rightskip}{0pt plus 5cm}SpaceShip::SpaceShip ()}}
\label{class_space_ship_ae56e545157e761155089250245ad3455}
Author: Ivan Collazo File: \hyperlink{spaceship_8cpp}{spaceship.cpp} Date: 10/05/2009 This is .cpp file for spaceships in earth20000

constructor 

Definition at line 17 of file spaceship.cpp.


\begin{DoxyCode}
18 {
19     shipsImage.load(":X-Wing-icon-1.png");
20     xPosition = 0;
21     yPosition = 0;
22     shipWidth = 0;
23     shipHeight = 0;
24     shipHit = 4;
25 }
\end{DoxyCode}
\hypertarget{class_space_ship_a4442daaa9cdc06a0ff885aedabf8abf0}{
\index{SpaceShip@{SpaceShip}!$\sim$SpaceShip@{$\sim$SpaceShip}}
\index{$\sim$SpaceShip@{$\sim$SpaceShip}!SpaceShip@{SpaceShip}}
\subsubsection[{$\sim$SpaceShip}]{\setlength{\rightskip}{0pt plus 5cm}SpaceShip::$\sim$SpaceShip ()\hspace{0.3cm}{\ttfamily  \mbox{[}virtual\mbox{]}}}}
\label{class_space_ship_a4442daaa9cdc06a0ff885aedabf8abf0}
destructor 

Definition at line 30 of file spaceship.cpp.


\begin{DoxyCode}
31 {
32 }
\end{DoxyCode}


\subsection{Member Function Documentation}
\hypertarget{class_space_ship_a209b405c57298a7fd22edcf609d9ab36}{
\index{SpaceShip@{SpaceShip}!boundingRect@{boundingRect}}
\index{boundingRect@{boundingRect}!SpaceShip@{SpaceShip}}
\subsubsection[{boundingRect}]{\setlength{\rightskip}{0pt plus 5cm}QRectF SpaceShip::boundingRect () const\hspace{0.3cm}{\ttfamily  \mbox{[}private, virtual\mbox{]}}}}
\label{class_space_ship_a209b405c57298a7fd22edcf609d9ab36}
this method does the bounding rectangle of the object for collision detection 

Reimplemented from \hyperlink{class_ship_a40856df827844b4045eb97345f401995}{Ship}.

Definition at line 136 of file spaceship.cpp.


\begin{DoxyCode}
137 {
138     return QRectF(335, 640, 90, 40);
139 }
\end{DoxyCode}
\hypertarget{class_space_ship_ac941a05362258554baff929244c9e9f7}{
\index{SpaceShip@{SpaceShip}!fireBullets@{fireBullets}}
\index{fireBullets@{fireBullets}!SpaceShip@{SpaceShip}}
\subsubsection[{fireBullets}]{\setlength{\rightskip}{0pt plus 5cm}void SpaceShip::fireBullets ()}}
\label{class_space_ship_ac941a05362258554baff929244c9e9f7}
this method make the sound for ships bullets 

Definition at line 144 of file spaceship.cpp.


\begin{DoxyCode}
145  {
146     QSound *gunFireFX = new QSound("44magnum.wav", 0);
147     gunFireFX->setLoops(1);
148     gunFireFX->play();
149 }
\end{DoxyCode}
\hypertarget{class_space_ship_a4fdfbd1a59a02df5897c2b37a49337c0}{
\index{SpaceShip@{SpaceShip}!fireMissiles@{fireMissiles}}
\index{fireMissiles@{fireMissiles}!SpaceShip@{SpaceShip}}
\subsubsection[{fireMissiles}]{\setlength{\rightskip}{0pt plus 5cm}void SpaceShip::fireMissiles ()}}
\label{class_space_ship_a4fdfbd1a59a02df5897c2b37a49337c0}
this method make the sound for ships missiles 

Definition at line 154 of file spaceship.cpp.


\begin{DoxyCode}
155 {
156     QSound *missileFireFX = new QSound("missile.wav", 0);
157     missileFireFX->setLoops(1);
158     missileFireFX->play();
159 }
\end{DoxyCode}
\hypertarget{class_space_ship_adfc89b9201d546c24ca0bd7b59b44d24}{
\index{SpaceShip@{SpaceShip}!paint@{paint}}
\index{paint@{paint}!SpaceShip@{SpaceShip}}
\subsubsection[{paint}]{\setlength{\rightskip}{0pt plus 5cm}void SpaceShip::paint (QPainter $\ast$ {\em painter}, \/  const QStyleOptionGraphicsItem $\ast$ {\em option}, \/  QWidget $\ast$ {\em widget})\hspace{0.3cm}{\ttfamily  \mbox{[}private, virtual\mbox{]}}}}
\label{class_space_ship_adfc89b9201d546c24ca0bd7b59b44d24}
this method is called whenever the spaceShip needs to be drawn 

Reimplemented from \hyperlink{class_ship_a1dad980a3b84bb77c63da853ec13477d}{Ship}.

Definition at line 37 of file spaceship.cpp.


\begin{DoxyCode}
38 {
39     // can later traverse to examine what collided with the character.
40     QList<QGraphicsItem*> listOfCollidingItems = collidingItems();
41 
42     // checks to see if collisions occurs
43     if (!listOfCollidingItems.isEmpty())
44     {
45         // if collision occurs with mothershipbullet or alienshipbullet decrement
      s shipHit
46         if ((listOfCollidingItems.first()->type() == ID_MOTHERSHIPBULLET) || (lis
      tOfCollidingItems.first()->type() == ID_ALIENSHIPBULLET))
47         {
48             shipHit--;
49 
50             // added by Manpreet Kohli
51             if (Constants::count == 3)
52             {
53                 this->scene()->removeItem(Constants::life3);        // remove a s
      pawn from the HUD
54                 Constants::count--;                                 // decrement 
      no. of lives remaining
55 
56                 // play respawn music
57                 QSound *spawnSound = new QSound("start.wav", 0);
58                 spawnSound->setLoops(1);
59                 spawnSound->play();
60 
61                 t->msleep(3000);
62             }           
63             else if (Constants::count == 2)
64             {
65                 this->scene()->removeItem(Constants::life2);        // remove a s
      pawn from the HUD
66                 Constants::count--;                                 // decrement 
      no. of lives remaining
67 
68                 // play respawn music
69                 QSound *spawnSound = new QSound("start.wav", 0);
70                 spawnSound->setLoops(1);
71                 spawnSound->play();
72 
73                 t->msleep(3000);
74             }            
75             else if (Constants::count == 1)
76             {
77                 this->scene()->removeItem(Constants::life1);        // remove a s
      pawn from the HUD
78                 Constants::count--;                                 // decrement 
      no. of lives remaining
79 
80                 // play respawn music
81                 QSound *spawnSound = new QSound("start.wav", 0);
82                 spawnSound->setLoops(1);
83                 spawnSound->play();
84 
85                 t->msleep(3000);
86             }      
87             else if (Constants::count == 0)
88             {
89                 // add game over logic
90                 QGraphicsView *temp  = this->scene()->views().at(0);
91 
92                 this->scene()->deleteLater();
93 
94                 QGraphicsScene *gameOverScene = new QGraphicsScene;
95 
96                 temp->setScene(gameOverScene);
97 
98                 gameOverScene->setSceneRect(0, 0, temp->geometry().width() - 5, t
      emp->geometry().height() - 5);       // set dimensions of the scene
99 
100                 QFont *font = new QFont();
101                 font->setBold(true);
102                 font->setPointSize(60);
103 
104                 // play game over music
105                 QSound *gameover = new QSound("gameover.wav", 0);
106                 gameover->setLoops(1);
107                 gameover->play();
108 
109                 // display game over message
110                 QGraphicsTextItem *gameOver = gameOverScene->addText(QString("GAM
      E OVER"), *font);
111                 gameOver->setDefaultTextColor(Qt::cyan);
112                 gameOver->setOpacity(0.8);
113                 gameOver->setPos(150, 200);
114 
115                 font->setPointSize(13);
116                 font->setWeight(75);
117 
118                 QPushButton *exit = new QPushButton(temp->parentWidget());
119                 exit->setText("EXIT");
120                 exit->setGeometry(300, 600, 150, 40);
121                 exit->setFont(*font);
122                 exit->show();
123                 exit->setStyleSheet("background-color: rgba(255, 255, 255, 100);"
      );
124 
125                 QObject::connect(exit, SIGNAL(clicked()), temp->parentWidget(), S
      LOT(close()));
126             }
127         }
128     }
129     painter->drawPixmap(335, 640, 90, 40, shipsImage); // paints the space shipIm
      age
130 }
\end{DoxyCode}
\hypertarget{class_space_ship_a4231df9fa04a8b82d07f62401000c1b7}{
\index{SpaceShip@{SpaceShip}!type@{type}}
\index{type@{type}!SpaceShip@{SpaceShip}}
\subsubsection[{type}]{\setlength{\rightskip}{0pt plus 5cm}virtual int SpaceShip::type () const\hspace{0.3cm}{\ttfamily  \mbox{[}inline, virtual\mbox{]}}}}
\label{class_space_ship_a4231df9fa04a8b82d07f62401000c1b7}


Definition at line 49 of file spaceship.h.


\begin{DoxyCode}
49 {return ID_SPACESHIP; }
\end{DoxyCode}


\subsection{Member Data Documentation}
\hypertarget{class_space_ship_a344d1e5b92d9286103aef6e1c27f0a76}{
\index{SpaceShip@{SpaceShip}!shipHeight@{shipHeight}}
\index{shipHeight@{shipHeight}!SpaceShip@{SpaceShip}}
\subsubsection[{shipHeight}]{\setlength{\rightskip}{0pt plus 5cm}qreal {\bf SpaceShip::shipHeight}\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_space_ship_a344d1e5b92d9286103aef6e1c27f0a76}


Reimplemented from \hyperlink{class_ship_a16205aae21b89c3fb57960a70be931a2}{Ship}.

Definition at line 29 of file spaceship.h.\hypertarget{class_space_ship_a53bc0fb5aa0a9b0c0d7fc70a76e1feda}{
\index{SpaceShip@{SpaceShip}!shipHit@{shipHit}}
\index{shipHit@{shipHit}!SpaceShip@{SpaceShip}}
\subsubsection[{shipHit}]{\setlength{\rightskip}{0pt plus 5cm}qreal {\bf SpaceShip::shipHit}\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_space_ship_a53bc0fb5aa0a9b0c0d7fc70a76e1feda}


Reimplemented from \hyperlink{class_ship_a1fd726a67e6b11d5ce19f4657db40237}{Ship}.

Definition at line 30 of file spaceship.h.\hypertarget{class_space_ship_a5bdb581da7eafb13095e97666ebe83bc}{
\index{SpaceShip@{SpaceShip}!shipsImage@{shipsImage}}
\index{shipsImage@{shipsImage}!SpaceShip@{SpaceShip}}
\subsubsection[{shipsImage}]{\setlength{\rightskip}{0pt plus 5cm}QPixmap {\bf SpaceShip::shipsImage}\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_space_ship_a5bdb581da7eafb13095e97666ebe83bc}


Reimplemented from \hyperlink{class_ship_a3e61137191ddd959a57e0cd8928b4873}{Ship}.

Definition at line 23 of file spaceship.h.\hypertarget{class_space_ship_a842854c644480d337e52fa125a838cce}{
\index{SpaceShip@{SpaceShip}!shipWidth@{shipWidth}}
\index{shipWidth@{shipWidth}!SpaceShip@{SpaceShip}}
\subsubsection[{shipWidth}]{\setlength{\rightskip}{0pt plus 5cm}qreal {\bf SpaceShip::shipWidth}\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_space_ship_a842854c644480d337e52fa125a838cce}


Reimplemented from \hyperlink{class_ship_ae57e882cf6611414d239b241f6711ba6}{Ship}.

Definition at line 28 of file spaceship.h.\hypertarget{class_space_ship_aa415fbdaccd76864a11592e738cf0348}{
\index{SpaceShip@{SpaceShip}!t@{t}}
\index{t@{t}!SpaceShip@{SpaceShip}}
\subsubsection[{t}]{\setlength{\rightskip}{0pt plus 5cm}{\bf SleeperThread}$\ast$ {\bf SpaceShip::t}\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_space_ship_aa415fbdaccd76864a11592e738cf0348}


Definition at line 33 of file spaceship.h.\hypertarget{class_space_ship_a4f960ec3383ec268c7db8c97b97a5c7d}{
\index{SpaceShip@{SpaceShip}!xPosition@{xPosition}}
\index{xPosition@{xPosition}!SpaceShip@{SpaceShip}}
\subsubsection[{xPosition}]{\setlength{\rightskip}{0pt plus 5cm}qreal {\bf SpaceShip::xPosition}\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_space_ship_a4f960ec3383ec268c7db8c97b97a5c7d}


Reimplemented from \hyperlink{class_ship_a6ccec9a60696c66ede61af7397c73b3c}{Ship}.

Definition at line 26 of file spaceship.h.\hypertarget{class_space_ship_a01360fa6f81ff5c448d68142293f578b}{
\index{SpaceShip@{SpaceShip}!yPosition@{yPosition}}
\index{yPosition@{yPosition}!SpaceShip@{SpaceShip}}
\subsubsection[{yPosition}]{\setlength{\rightskip}{0pt plus 5cm}qreal {\bf SpaceShip::yPosition}\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_space_ship_a01360fa6f81ff5c448d68142293f578b}


Reimplemented from \hyperlink{class_ship_a5964ed05737d3b6722c7af5e0f173475}{Ship}.

Definition at line 27 of file spaceship.h.

The documentation for this class was generated from the following files:\begin{DoxyCompactItemize}
\item 
C:/Users/Kohli/Desktop/Earth-\/20000/\hyperlink{spaceship_8h}{spaceship.h}\item 
C:/Users/Kohli/Desktop/Earth-\/20000/\hyperlink{spaceship_8cpp}{spaceship.cpp}\end{DoxyCompactItemize}
